package pers.course.week9;

import java.util.*;

public class HighestFrequency {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        String[] cs = str.split(" ");
        Map<String, Integer> map = new TreeMap<>();
        for (String ch : cs) {
            if (map.containsKey(ch)) {
                int count = map.get(ch) + 1;
                map.put(ch, count);
            } else {
                map.put(ch, 1);
            }
        }
        List<Map.Entry<String, Integer>> list = new ArrayList<>(map.entrySet());
        list.sort((Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) -> -o1.getValue().compareTo(o2.getValue()));
        StringBuffer sb = new StringBuffer();
        int max = list.get(0).getValue();
        sb.append(list.get(0).getKey());
        for (int i = 1; i < list.size(); i++) {
            if (list.get(i).getValue() == max) {
                max = list.get(i).getValue();
                sb.append(" ").append(list.get(i).getKey());
            }
        }
        System.out.println(sb);
    }
}
